<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
                <link href="../style/main.css" type="text/css" rel="stylesheet">
                <link href="../style/return_message.css" type="text/css" rel="stylesheet">
        <script type="text/javascript" src="../script/jquery-1.8.2.js"></script>
        <script type="text/javascript" src="../script/js1.js"></script>
        <script type="text/javascript" src="../script/register.js"></script>
</head>

<body>

 <header>
        <?php
        session_start();
        mysql_connect("localhost:3306", "root", "16886611");
        mysql_select_db("digitalsales");
        if(isset($_GET["action"])){
            if($_GET["action"]=="logout"){
               $_SESSION["username"]=NULL;
            }
        }
        if(!isset($_SESSION["username"])||$_SESSION["username"]==NULL){
        echo '<ul>
                 <li>
                    <p><a href="../index.php">Homepage</a></p>
                  </li>
                </ul>';
        }else{
            echo '<ul>
                <li id="logout">
                  <p><a href="../PhpProject1/index.php?action=logout">Log out</a></p>
                </li>
                 <li>
                    <p><a href="../PhpProject1/index.php?action=logout">My Account</a></p>
                  </li>
                  <li>
                    <p><a href="../digita1sale/index.php?action=logout">My Orders</a></p>
                  </li>
                  <li>
                    <p>Welcome back,'.$_SESSION["username"].'!</p>
                  </li>
                </ul>';
        }
        
        ?>
        </header>

    <div id="return_message">
<?php
$con = mysql_connect("localhost:8889","root","root");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("digitalsales", $con);

$sql='INSERT INTO orders (CUSTOMER, PRODUCT, STORE, AMOUNT, START_DATE)
VALUES
("'.$_SESSION["username"].'","'.$_GET["pid"].'","'.$_GET["STOREID"].'","'.$_GET["quantity"].'","121127")';

if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }
echo "You have successfully ordered!<br>You will be redirected to My Orders page in 3 seconds.";

mysql_close($con);
?>

    </div>

<meta content="3;../myAccount/order.php" http-equiv="Refresh" />
</body>

</html>